This sample demonstrates usage of the OpenMP* parallel framework support in Intel® Fortran. The sample includes three variants of the NQueens program: a base serial version, an OpenMP* version, and a Backtrack Tree method version.

For more information, see OpenMP* Support in the Intel® Fortran Compiler User and Reference Guide available from the Intel® Software Documentation Library.

The sample is based on the original C++ code by Ralf Ratering & Mario Deilmann. The Fortran version is by Steve Lionel.

Read http://en.wikipedia.org/wiki/Nqueens for background information.

Information about the Backtrack Tree method is described by Martin Richards in "Backtracking Algorithms in MCPL using Bit Patterns and Recursion".

System Requirements

Minimum requirements include a PC based on an IA-32 or Intel® 64 architecture processor supporting the Intel® Streaming SIMD Extensions 2 (Intel® SSE2) instructions (Intel® Pentium® 4 processor or later, or compatible non-Intel processor), and supported versions of the Microsoft Windows* operating system, Microsoft Visual Studio*, and the Intel® Visual Fortran compiler. Refer to the Intel® Parallel Studio XE product Release Notes for details on the complete system requirements.

Build Instructions

Expand the ZIP file to a writable directory of your choice. The three variants can be built using either the Microsoft Visual Studio* solution or command-line build script build.bat file included with the sample. The build.bat file accepts an optional command-line argument from the following list:

Each variant requires the same input argument corresponding to the board size, and each reports the number of solutions found and timing for the calculations. The program variants can be run repeatedly with different board sizes to exhibit the performance improvements possible with OpenMP*. 

To set the command line argument in Microsoft Visual Studio*, right click on the project name and select Properties. Under Debugging, enter the argument (board size) in Command Arguments.